function mBoxInfo(msg){
		$.modal('<div class="help">'+ msg +'</div><br /><div><input type="button" value="Tutup" onclick="$.modal.close()" class="button left" /><div>', {});
		return false;
	}
	
	function mBoxInfoReload(msg){
		$.modal('<div class="help">'+ msg +'</div><br /><div><input type="button" value="Tutup" onclick="lShow();document.location.reload(true);" class="button left btnreset" /><div>', {});
		return false;
	}
	
	function mBoxConf(msg,uri){
		$.modal('<div>'+ msg +'</div><br /><div><input type="button" value="Tidak" onclick="$.modal.close()" class="button left btnreset" /><input type="button" value="Ya" onclick="document.location=uri" class="button right btnreset" /><div>', {});
		return false;
	}
	function mBoxConfReturn(msg){
		$.modal('<div>'+ msg +'</div><br /><div><input type="button" value="Tidak" onclick="$.modal.close()" class="button left btnreset" /><input type="button" value="Ya" onclick="return true" class="button right btnreset" /><div>', {});
		return false;
	}
	function getCaptcha(id){
		$.post(MOD_URL+"get-captcha",function(o){$('#'+id).html(o);});
	}

   	$(document).ready(function(){
		$(".picker").datepicker();
		$('.south').tipsy({gravity: 's',fade:true,html:true});
		$('.west').tipsy({gravity: 'w',fade:true,html:true});
		$('.north').tipsy({gravity: 'n',fade:true,html:true});
		$('.east').tipsy({gravity: 'e',fade:true,html:true});
		mainmenu();
		
		$('.hiden').each(function(){
			$(this).click(function(){
				$(this).parent().fadeOut("medium",function(){
					$(this).remove();
				});
			});
		});
		
		$("input,option,textarea").focus(function(){
			if($(this).attr("type")=="button"||$(this).attr("type")=="submit" || $(this).attr("type")=="reset")
				return false;	
			$(this).css("background-color","#FFEDAF");					  			

		}).blur(function(){
			if($(this).attr("type")=="button"||$(this).attr("type")=="submit" || $(this).attr("type")=="reset")
				return false;	
			$(this).css("background-color","#fff");		
		});
		
		$('.confirm').each(function(){
			$(this).click(function(){
				msg=$(this).attr('rel');uri=$(this).attr('href');				
				mBoxConf(msg,uri);	
				return false;		
			});
		});
		
		$('a.help').each(function(){ 
			$(this).click(function(){
				msg=$(this).attr('rel');				
				mBoxInfo(msg);
				return false;						
			});
		});
		
		$('.simple').each(function(){
			$(this).click(function(){			
				if($(this).attr('href').split("")[0]=="#"){				
					$($(this).attr('href')).modal('',{onOpen: function (dialog) {
						dialog.overlay.fadeIn('medium',function () {
							dialog.data.fadeIn("medium",function(){
								dialog.container.fadeIn('slow');
							});
						});				
					},
						onClose: function (dialog) {
							dialog.container.fadeOut('slow', function () {
								dialog.overlay.fadeOut('slow',function(){
									$.modal.close();
								});
						});
					},opacity:10
					});
				}else{	
					width = ($(this).attr('rel').split(",")[0] == '')?600:$(this).attr('rel').split(",")[0];
					height = (typeof $(this).attr('rel').split(",")[1] == 'undefined')?400:$(this).attr('rel').split(",")[1];
					$.modal('<iframe src="' + $(this).attr('href') + '" height="'+height+'" width="'+width+'" style="border:0">', {});
					return false;
				}
				
			});
		});	
		
	});
	
function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
}
